Advances in wearable electronics, personal mobile devices, and sensor technology are opening the door to many promising applications in medical care and biomedical research. However, the resulting datasets are often challenging to process due to variability caused by extraneous effects unrelated to the tasks of interest, such as changes in environmental conditions, heteroscedasticity in measurement noise, or patient idiosyncrasies. These effects produce systematic differences between the data used to train machine- learning algorithms and the data on which they are applied in practice, impairing real-world performance. The proposed research will address the fundamental problem of factoring out extraneous effects associated with known nuisance variables. We will develop a novel methodology for extracting features that ar.e invariant to nuisance variables-and hence also to the associated extraneous effects-but that are still useful for classification or regression. The methodology is based on nonparametric deep-network models that perform automatic normalization of the data, and further enforce invariance via adversarial learning. We will apply the approach to an important problem in stroke rehabilitation, the quantitated dosing of motor training. Using a dataset of sensor-based motion data, we will train the model to identify and count functional movements in stroke patients performing rehabilitation activities. We expect to show that our approach can surmount patient variability to enable rigorous movement classification and quantitation. The proposed work is significant, because it will empower investigators to undertake the dosing trials critically needed in stroke rehabilitation. The proposed work is innovative, because it departs from traditional data preprocessing techniques by combining advanced data normalization and model calibration procedures. Our work is likely to have a positive impact on stroke rehabilitation by facilitating the research required to change clinical practice and improve stroke outcomes. Our quantitative approach is broadly generalizable to applications hindered by nuisance variables, such as medical diagnostics and genomics.